#pragma once
#include "wtypes.h"
#include <string>
#include <vector>
#include <fstream>
using std::string;
using std::vector;
using std::ifstream;

typedef std::vector<std::string> StringVector;
typedef std::vector<StringVector> StringVectorVector;

class RWFile
{
public:
	RWFile(void);
	~RWFile(void);
	static bool IsFileExists(const string& _FileName);
	static int GetFileSize(const string& _FileName);
	static bool LoadFile(const string& _FileName,string& _Buff);
	static bool SaveFile(const string& _FileName, const string& _Buff);
	static bool SaveFile(const string& _FileName, char* _Buff, int _BuffLen);
	static bool LoadAllLine(const string& _FileName, vector<string>& _Lines);
	static bool AppendFile(const string& _FileName, string& _Buff);
	static bool AppendFile(const string& _FileName, char* _Buff, int _BuffLen);
	static string GetCurPath();
	static string GetExtFullPath();
	static string GetExeFullDir();
	static string StripFileExt(string _FileName);
	static string GetFileExt(string _FileName);
	static string GetFileNameFromPath(const string& _Path);
	static string GetFilePathFromPath(const string& _Path);
	static void MkDir(const string& _FileOrDir, bool _IsFile = false);
	static void FindAllFile(const string& _RootName, const string& _DirName, const string& _Mark, vector<string>& _FileList, BOOL incSub);
	static StringVector split(const std::string& str, char delim = ',', int maxSplits = 0); 
	static void fetchFileData(const std::string &name, StringVectorVector& fileData, char delim = ',');
	static void string_replace(std::string& s1, const std::string& s2, const std::string& s3);
};
